package com.wanbatv.wangwangba.app;

import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;

import com.wanbatv.wangwangba.utils.Product;

/**
 * Created by Forcs on 15/7/22.
 */
public class WwbApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        try {
            //从androidmainfest.xml获取产品渠道号
            ApplicationInfo appInfo = this.getPackageManager()
                    .getApplicationInfo(getPackageName(),
                            PackageManager.GET_META_DATA);
            Product.flavor = appInfo.metaData.getString("PRODUCT_FLAVOR");
            Product.appId = appInfo.metaData.getString("PRODUCT_APPID");
            Product.appKey = appInfo.metaData.getString("PRODUCT_APPKEY");
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}
